package edu.ptu.acl.common;

import lombok.Getter;

import java.util.concurrent.TimeUnit;

public class MyConstants {
    @Getter
    public static enum ResultCode{
        SUCCESS(2000, "success"),


        FAILED(5000, "failed"),
        ERROR(5001, "未知错误"),
        VALIDATE_FAILED(5002, "参数校验失败"),
        USER_NOT_EXIST(5003,"用户不存在"),
        USER_PASS_ERROR(5004,"密码错误"),
        USER_IS_FREEZE(5005,"用户被冻结"),
        USER_NOT_LOGIN(5006,"未登录"),
        TOKEN_PARSE_ERROR(5007,"token解析错误，请重新登陆"),
        USER_LOGIN_EXP_TIME(5008,"登陆超时，请重新登陆"),
        USER_LOGIN_OTHER_CLIENT(5009,"已在其他客户端登陆，请重新登陆"),
        OPTIMISTIC_LOCKING(5010,"数据异常，请刷新界面重试"),
        NO_AUTH(5011,"没有权限，请联系管理员")

        ;



        private int code;
        private String msg;

        ResultCode(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }
    }
    @Getter
    public static enum Jwt{
        PRIVATE_KEY("ygrfbsdfshfdsag");

        private String value;

        Jwt(String value){
            this.value=value;
        }
    }

    @Getter
    public static enum UserState{
        FREEZE("0"),
        NORMAL("1");

        private String state;

        UserState(String state){
            this.state=state;
        }
    }

    @Getter
    public static enum RedisExTime{

        USER_LOGIN_EX_TIME(30,TimeUnit.MINUTES);

        private int exTime;
        private TimeUnit timeUnit;

        RedisExTime(int exTime,TimeUnit timeUnit){
            this.exTime = exTime;
            this.timeUnit = timeUnit;
        }
    }

    @Getter
    public static enum Tree{
        ROOT(0L);

        private Long flag;

        Tree(Long flag) {
            this.flag = flag;
        }
    }

    @Getter
    public enum LogType{
        ROLE_USER("1"),
        ROLE_ACL("2")
        ;

        private String type;

        LogType(String type) {
            this.type = type;
        }
    }

    @Getter
    public enum AclType{
        ACL("0"),
        BUTTON("1"),
        COMPONENT("2")
        ;
        private String id;

        AclType(String id) {
            this.id = id;
        }
    }

    @Getter
    public enum AclStatus{
        FREEZE("0"),
        NORMAL("1");
        ;


        private String id;

        AclStatus(String id) {
            this.id = id;
        }
    }
}
